package com.sgzn.sgpay.service.tcp.model;

import com.sgzn.sgpay.service.tcp.SgTcpProtocolHead;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * Created by xxjs-gd-llf
 * DATETIME:2018/4/11 23:18
 * Description: 服务器应答心跳码
 */
@Setter
@Getter
public class TcpHeartBeatResponse {
    String beginCode;

    String commandCode;


    @NotBlank
    @Length(max = 8)
    String deviceId;

    String heartBeatCode;

    @NotBlank
    @Length(max = 2)
    String checkSumCode;

    private String endCode;

    @Override
    public String toString(){
        //根据协议规范重载toString方法
        return   beginCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                commandCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                deviceId + SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                heartBeatCode + SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                checkSumCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR+
                endCode+ SgTcpProtocolHead.TCP_SEND_SEPERATOR;

    }

}
